package vno.sci.window
{
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;
	
	import org.aswing.AssetBackground;
	import org.aswing.Icon;
	import org.aswing.JButton;

	public final class MyButton extends JButton
	{
		public var id:String = "";
		internal var default_: AssetBackground;
		internal var mouseOver : AssetBackground;
		internal var mouseDown : AssetBackground;
		public function MyButton(_id:String, icon:Icon, text:String, _default:DisplayObject, _mouseOver:DisplayObject, _mouseDown:DisplayObject)
		{
			super(text,icon);
			this.id = _id;
			default_ = new AssetBackground(_default);
			mouseOver = new AssetBackground(_mouseOver);
			mouseDown = new AssetBackground(_mouseDown);
			super.setBackgroundDecorator(default_);
			this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
			this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
			this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
			this.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
		}
		
		private function onMouseUp(event:MouseEvent):void
		{
			// TODO Auto-generated method stub
			this.setBackgroundDecorator(mouseOver);
		}
		
		private function onMouseOut(event:MouseEvent):void
		{
			// TODO Auto-generated method stub
			this.setBackgroundDecorator(default_);
		}
		
		private function onMouseDown(event:MouseEvent):void
		{
			// TODO Auto-generated method stub
			this.setBackgroundDecorator(mouseDown);
		}
		
		private function onMouseOver(event:MouseEvent):void
		{
			// TODO Auto-generated method stub
			
			this.setBackgroundDecorator(mouseOver);
		}
	}
}